package com.atguigu;

import com.atguigu.configrationProperties.UserProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpProperties;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.PropertySource;

import javax.servlet.ServletContext;

/**
 * @author 张晓
 * @create 2020-10-15 11:35
 *
 * @SpringBootApplication 来标注一个主程序类，说明这是一个Spring Boot应用
 *
 */
@SpringBootApplication
@PropertySource("user.properties")
@EnableConfigurationProperties({ UserProperties.class})
public class HelloWorldMainApplication {
    public static void main(String[] args) {
        //Spring应用启动起来
        ConfigurableApplicationContext ioc = SpringApplication.run(HelloWorldMainApplication.class, args);
        UserProperties bean = ioc.getBean(UserProperties.class);
        System.out.println(bean);
    }
}
